class Solution:
    def findMin(self, nums: list) -> int:
        left = 0
        right = len(nums) - 1
        while left < right - 1:
            mid = (left + right) // 2
            if nums[mid] > nums[left] and nums[mid] > nums[right]:
                left = mid
            elif nums[mid] < nums[left] and nums[mid] < nums[right]:
                right = mid
            elif nums[mid] > nums[left] and nums[mid] < nums[right]:
                right = mid
            elif nums[mid] < nums[left] and nums[mid] > nums[right]:
                left = mid

        return min(nums[left], nums[right])
